<?php

class IndexAction extends Action {
    public function index(){
    	import('ORG.Net.Api');
        $apiurl = new Api();
        $uid=$_SESSION['phone_uid'];
        $sid=$_SESSION['s_id'];
        $app_kind=$_SESSION['ibg_k'];
        $api=$apiurl->o2o();
        $img=$apiurl->loadimg();
        $pd=$apiurl->pindao($uid,$sid);
        $hoturl=$apiurl->hot($app_kind,365);
        $newhturl=$apiurl->newht($app_kind,365);
        $url=file_get_contents($api);
        $info=json_decode($url,true);

        $hot=file_get_contents($hoturl);
        $hotinfo=json_decode($hot,true);       
        
        $pdurl=file_get_contents($pd);        
        $pdinfo=json_decode($pdurl);
        $pdlist=json_decode($pdinfo->list,true);

        $newht=file_get_contents($newhturl);
        $newh=json_decode($newht,true);

        unset($pdlist['ibg_udid']);
    	foreach ($pdlist as $key => $value) {
    		
            $this->assign("pdlist",$value);
            
   		}
        unset($hotinfo['size']);
        foreach ($hotinfo as $k => $v) {
            $this->assign("hot",$v);
        }
        unset($newh['size']);
        foreach ($newh as $ke => $va) {
            $this->assign("newht",$va);    
            // echo "<pre>";
            // dump($va);        
        }
        $this->assign("img",$img);
        $this->assign("list",$info['list']);
    	$this->display();
   		// //dump($info);
        // echo "<pre>";
        // dump($newhturl);
        //echo $newhturl;
        
    }

    public function header(){
    	$this->display();
    }

    public function footer(){
    	$this->display();
    }
}